<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Table Demo</title>
    <script src="../vendor/jquery/jquery.js"></script>
</head>

<script>
    $(function () {
        $("#sendTask").click(function () {
            //构造tasks数组
            var tasks = [];
            var task = {};
            task.id = "1";
            task.cooperativesName = "!";
            task.orderId = 5;
            task.goodsId = 3;
            task.goodsName = "name";
            task.ptName = "ptTest";
            tasks.push(task);

            //从后台获取商品列表
            $.ajax({
                url: "/erp/prodtask/add/tasks",
                dataType:"json",
                data:JSON.stringify(tasks),
                type:"POST",
                contentType:"application/json",
                //请求成功回调此函数，data为返回的数据
                success:function (data) {
                    console.log(data);
                }
            })
        })
    })
</script>

<body>

    <button id="sendTask">click me</button>
</body>
</html>
